﻿'Digite o NameSpace: Acesso
'Digite o nome da Classe de dominio: Senha

'--TESTE:-----------
'    <TestMethod()> _
'    Public Sub SalvarSenha()
'        Dim _Senha As Senha
'        _Senha = New Senha
'
'        _Senha.Salvar()
'
'        Assert.IsTrue(_Senha.Id.HasValue)
'    End Sub
<Serializable()> _
Public Class Senha
    Inherits BaseDominio

    Private _usuario As Usuario
    Public Overridable Property Usuario() As Usuario
        Get
            Return _usuario
        End Get
        Set(ByVal value As Usuario)
            _usuario = value
        End Set
    End Property

    Private _vigente As Boolean
    Public Overridable Property Vigente() As Boolean
        Get
            Return _vigente
        End Get
        Set(ByVal value As Boolean)
            _vigente = value
        End Set
    End Property

    Private _senha As String
    Friend Overridable Property Senha() As String
        Get
            Return _senha
        End Get
        Set(ByVal value As String)
            _senha = value
        End Set
    End Property

    Private _salt As Integer
    Public Overridable Property Salt() As Integer
        Get
            Return _salt
        End Get
        Set(ByVal value As Integer)
            _salt = value
        End Set
    End Property

    Private _ehCase As Boolean
    Public Overridable Property EhCase() As Boolean
        Get
            Return _ehCase
        End Get
        Set(ByVal value As Boolean)
            _ehCase = value
        End Set
    End Property

    Private _dataCriacao As Nullable(Of DateTime)
    Public Overridable Property DataCriacao() As Nullable(Of DateTime)
        Get
            Return _dataCriacao
        End Get
        Set(ByVal value As Nullable(Of DateTime))
            _dataCriacao = value
        End Set
    End Property

    Private _dataDeMudanca As Nullable(Of DateTime)
    Public Overridable Property DataDeMudanca() As Nullable(Of DateTime)
        Get
            Return _dataDeMudanca
        End Get
        Set(ByVal value As Nullable(Of DateTime))
            _dataDeMudanca = value
        End Set
    End Property


    Private _dataExpiracao As Nullable(Of DateTime)
    Public Overridable Property DataExpiracao() As Nullable(Of DateTime)
        Get
            Return _dataExpiracao
        End Get
        Set(ByVal value As Nullable(Of DateTime))
            _dataExpiracao = value
        End Set
    End Property

    Enum Status
        NaoProcessado
        NaoAutenticado
        SenhaExpirada
        UsuarioBloqueado
        Autenticado
    End Enum

#Region "Negocio"

    Friend Sub New()
        MyBase.New()
    End Sub

    Friend Overridable Function Buscar(ByVal _id As Long) As Senha
        Return MyBase.SenhaDao.Buscar(_id)
    End Function

    Friend Overridable Sub Salvar()
        MyBase.SenhaDao.Salvar(Me)
    End Sub

    Friend Overridable Sub AlterarSenha(ByVal _antiga As String, ByVal _nova As String)
        Throw New NotImplementedException
    End Sub

    Public Overridable Function Autentica(ByVal _senha As String) As Boolean
        'A SENHA SOMA AO SALT CALCULA O HASH = SENHA CRIPTOGRAFADA EM BANCO
        Throw New NotImplementedException
    End Function

#End Region

End Class

